WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
wolf::TrackMatrix Class Reference

Matrix of tracked features, by track and by snapshot (Captures or time stamps) This class implements the following data structure: More...

#include <core/processor/track_matrix.h>

Public Member Functions

 TrackMatrix ()
 Default constructor. More...
 
virtual ~TrackMatrix ()
 Destructor. More...
 
void newTrack (FeatureBasePtr _ftr)
 Creates a new track with a feature. More...
 
void add (const SizeStd &_track_id, const FeatureBasePtr &_ftr)
 Adds a feature (linked to a capture) to an existing track, setting its track id. More...
 
void add (const FeatureBasePtr &_ftr_existing, const FeatureBasePtr &_ftr_new)
 Adds a feature to the track of an existing feature. More...
 
void remove (FeatureBasePtr _ftr)
 Removes a feature from its track and snapshot. More...
 
void remove (const SizeStd &_track_id)
 Removes a track and its features from all snapshots. More...
 
void remove (CaptureBasePtr _cap)
 Removes the snapshot of a capture and its features from all tracks. More...
 
SizeStd numTracks () const
 Returns the number of tracks. More...
 
SizeStd trackSize (const SizeStd &_track_id) const
 Returns the number of features of a track. More...
 
TrackConst track (const SizeStd &_track_id) const
 Returns a track: its features indexed by time stamp. More...
 
Track track (const SizeStd &_track_id)
 Returns a track: its features indexed by time stamp. More...
 
SnapshotConst snapshot (CaptureBaseConstPtr _capture) const
 Returns the snapshot of a capture: its features indexed by track id. More...
 
Snapshot snapshot (CaptureBasePtr _capture)
 Returns the snapshot of a capture: its features indexed by track id. More...
 
vector< FeatureBaseConstPtr > trackAsVector (const SizeStd &_track_id) const
 Returns the features of a track as a vector, ordered by time stamp. More...
 
vector< FeatureBasePtr > trackAsVector (const SizeStd &_track_id)
 Returns the features of a track as a vector, ordered by time stamp. More...
 
FeatureBaseConstPtrList snapshotAsList (CaptureBaseConstPtr _cap) const
 Returns the features of the snapshot of a capture as a list. More...
 
FeatureBasePtrList snapshotAsList (CaptureBasePtr _cap)
 Returns the features of the snapshot of a capture as a list. More...
 
TrackMatchesConst matches (CaptureBaseConstPtr _cap_1, CaptureBaseConstPtr _cap_2) const
 Returns the pairs of features of two captures in the same track, indexed by track id. More...
 
TrackMatches matches (CaptureBasePtr _cap_1, CaptureBasePtr _cap_2)
 Returns the pairs of features of two captures in the same track, indexed by track id. More...
 
FeatureBaseConstPtr firstFeature (const SizeStd &_track_id) const
 Returns the oldest feature of a track. More...
 
FeatureBasePtr firstFeature (const SizeStd &_track_id)
 Returns the oldest feature of a track. More...
 
FeatureBaseConstPtr lastFeature (const SizeStd &_track_id) const
 Returns the newest feature of a track. More...
 
FeatureBasePtr lastFeature (const SizeStd &_track_id)
 Returns the newest feature of a track. More...
 
FeatureBaseConstPtr feature (const SizeStd &_track_id, CaptureBaseConstPtr _cap) const
 Returns the feature of a track in a capture. More...
 
FeatureBasePtr feature (const SizeStd &_track_id, CaptureBasePtr _cap)
 Returns the feature of a track in a capture. More...
 
CaptureBaseConstPtr firstCapture (const SizeStd &_track_id) const
 Returns the capture of the oldest feature of a track. More...
 
CaptureBasePtr firstCapture (const SizeStd &_track_id)
 Returns the capture of the oldest feature of a track. More...
 
CaptureBaseConstPtr lastCapture (const SizeStd &_track_id) const
 Returns the capture of the newest feature of a track. More...
 
CaptureBasePtr lastCapture (const SizeStd &_track_id)
 Returns the capture of the newest feature of a track. More...
 
list< SizeStd > trackIds (CaptureBaseConstPtr _capture=nullptr) const
 Returns the ids of the tracks of a capture snapshot (all tracks if nullptr) More...
 
CaptureBaseConstPtrList captures () const
 Returns the captures of all snapshots, ordered by time stamp. More...
 
CaptureBasePtrList captures ()
 Returns the captures of all snapshots, ordered by time stamp. More...
 
CaptureBaseConstPtr capture (const TimeStamp &_ts, const double &_time_tolerance) const
 Returns the capture of the snapshot closest to a time stamp, within a time tolerance. More...
 
CaptureBasePtr capture (const TimeStamp &_ts, const double &_time_tolerance)
 Returns the capture of the snapshot closest to a time stamp, within a time tolerance. More...
 
TrackConst trackAtKeyframes (const SizeStd &_track_id) const
 Returns the features of a track whose captures belong to a keyframe (in the problem) More...
 
Track trackAtKeyframes (const SizeStd &_track_id)
 Returns the features of a track whose captures belong to a keyframe (in the problem) More...
 
void cleanSnapshots ()
 Removes the snapshots of the captures being removed (e.g. when a keyframe is removed) More...
 

Detailed Description

Matrix of tracked features, by track and by snapshot (Captures or time stamps) This class implements the following data structure:

Snapshots at each capture Cx: C1 C2 C3 C4 C5 Tracks for each matched feature: f1 — f3 — f7 — f11 – f14 <– track 1, of corresponding features in different captures | | | | | | f4 — f8 — f12 – f15 <– track 2 | | | | | f5 — f9 — f13 <– track 3 | | | f2 — f6 — f10 <– track 4

Each 'f' is a feature pointer of the type FeatureBasePtr

This structure allows accessing all the history of matched features with two different accesses:

 Track:    track-wise:   a track of features matches along a timely sequence of Captures, indexed by time stamp.

                         map<TimeStamp ts, FeatureBasePtr f>

 Snapshot: capture-wise: a set of features tracked in a single Capture, indexed by track id:

                         map<SizeStd track_id, FeatureBasePtr f>

The class makes sure that both accesses are consistent each time some addition or removal of features is performed.

The storage is implemented as two maps of maps, so each addition and removal of single features is accomplished in logarithmic time:

 Tracks are identified with the track ID in           f->trackId()
 Snapshots are identified with the Capture pointer in f->getCapture()

the track ID of FeatureBase is set each time a feature (already linked to its capture) is added to the track matrix:

 add(track_id, f) will set f.track_id = track_id.

so e.g. given a feature f,

 track   (f->trackId()) ;       // returns all the track where feature f is.
 snapshot(f->getCapture()) ;    // returns all the features in the same capture of f.

Constructor & Destructor Documentation

◆ TrackMatrix()

wolf::TrackMatrix::TrackMatrix ( )

Default constructor.

◆ ~TrackMatrix()

wolf::TrackMatrix::~TrackMatrix ( )
virtual

Destructor.

Member Function Documentation

◆ add() [1/2]

void wolf::TrackMatrix::add ( const FeatureBasePtr &  _ftr_existing,
const FeatureBasePtr &  _ftr_new 
)

Adds a feature to the track of an existing feature.

◆ add() [2/2]

void wolf::TrackMatrix::add ( const SizeStd &  _track_id,
const FeatureBasePtr &  _ftr 
)

Adds a feature (linked to a capture) to an existing track, setting its track id.

◆ capture() [1/2]

CaptureBasePtr wolf::TrackMatrix::capture ( const TimeStamp &  _ts,
const double &  _time_tolerance 
)

Returns the capture of the snapshot closest to a time stamp, within a time tolerance.

Parameters
_tsthe time stamp
_time_tolerancethe maximum time difference
Returns
the closest capture, or nullptr if no capture is within the time tolerance

◆ capture() [2/2]

CaptureBaseConstPtr wolf::TrackMatrix::capture ( const TimeStamp &  _ts,
const double &  _time_tolerance 
) const

Returns the capture of the snapshot closest to a time stamp, within a time tolerance.

Parameters
_tsthe time stamp
_time_tolerancethe maximum time difference
Returns
the closest capture, or nullptr if no capture is within the time tolerance

◆ captures() [1/2]

CaptureBasePtrList wolf::TrackMatrix::captures ( )

Returns the captures of all snapshots, ordered by time stamp.

◆ captures() [2/2]

CaptureBaseConstPtrList wolf::TrackMatrix::captures ( ) const

Returns the captures of all snapshots, ordered by time stamp.

◆ cleanSnapshots()

void wolf::TrackMatrix::cleanSnapshots ( )

Removes the snapshots of the captures being removed (e.g. when a keyframe is removed)

◆ feature() [1/2]

FeatureBaseConstPtr wolf::TrackMatrix::feature ( const SizeStd &  _track_id,
CaptureBaseConstPtr  _cap 
) const

Returns the feature of a track in a capture.

◆ feature() [2/2]

FeatureBasePtr wolf::TrackMatrix::feature ( const SizeStd &  _track_id,
CaptureBasePtr  _cap 
)

Returns the feature of a track in a capture.

◆ firstCapture() [1/2]

CaptureBasePtr wolf::TrackMatrix::firstCapture ( const SizeStd &  _track_id)

Returns the capture of the oldest feature of a track.

◆ firstCapture() [2/2]

CaptureBaseConstPtr wolf::TrackMatrix::firstCapture ( const SizeStd &  _track_id) const

Returns the capture of the oldest feature of a track.

◆ firstFeature() [1/2]

FeatureBasePtr wolf::TrackMatrix::firstFeature ( const SizeStd &  _track_id)

Returns the oldest feature of a track.

◆ firstFeature() [2/2]

FeatureBaseConstPtr wolf::TrackMatrix::firstFeature ( const SizeStd &  _track_id) const

Returns the oldest feature of a track.

◆ lastCapture() [1/2]

CaptureBasePtr wolf::TrackMatrix::lastCapture ( const SizeStd &  _track_id)

Returns the capture of the newest feature of a track.

◆ lastCapture() [2/2]

CaptureBaseConstPtr wolf::TrackMatrix::lastCapture ( const SizeStd &  _track_id) const

Returns the capture of the newest feature of a track.

◆ lastFeature() [1/2]

FeatureBasePtr wolf::TrackMatrix::lastFeature ( const SizeStd &  _track_id)

Returns the newest feature of a track.

◆ lastFeature() [2/2]

FeatureBaseConstPtr wolf::TrackMatrix::lastFeature ( const SizeStd &  _track_id) const

Returns the newest feature of a track.

◆ matches() [1/2]

TrackMatchesConst wolf::TrackMatrix::matches ( CaptureBaseConstPtr  _cap_1,
CaptureBaseConstPtr  _cap_2 
) const

Returns the pairs of features of two captures in the same track, indexed by track id.

◆ matches() [2/2]

TrackMatches wolf::TrackMatrix::matches ( CaptureBasePtr  _cap_1,
CaptureBasePtr  _cap_2 
)

Returns the pairs of features of two captures in the same track, indexed by track id.

◆ newTrack()

void wolf::TrackMatrix::newTrack ( FeatureBasePtr  _ftr)

Creates a new track with a feature.

◆ numTracks()

SizeStd wolf::TrackMatrix::numTracks ( ) const

Returns the number of tracks.

◆ remove() [1/3]

void wolf::TrackMatrix::remove ( CaptureBasePtr  _cap)

Removes the snapshot of a capture and its features from all tracks.

◆ remove() [2/3]

void wolf::TrackMatrix::remove ( const SizeStd &  _track_id)

Removes a track and its features from all snapshots.

◆ remove() [3/3]

void wolf::TrackMatrix::remove ( FeatureBasePtr  _ftr)

Removes a feature from its track and snapshot.

◆ snapshot() [1/2]

SnapshotConst wolf::TrackMatrix::snapshot ( CaptureBaseConstPtr  _capture) const

Returns the snapshot of a capture: its features indexed by track id.

◆ snapshot() [2/2]

Snapshot wolf::TrackMatrix::snapshot ( CaptureBasePtr  _capture)

Returns the snapshot of a capture: its features indexed by track id.

◆ snapshotAsList() [1/2]

FeatureBaseConstPtrList wolf::TrackMatrix::snapshotAsList ( CaptureBaseConstPtr  _cap) const

Returns the features of the snapshot of a capture as a list.

◆ snapshotAsList() [2/2]

FeatureBasePtrList wolf::TrackMatrix::snapshotAsList ( CaptureBasePtr  _cap)

Returns the features of the snapshot of a capture as a list.

◆ track() [1/2]

Track wolf::TrackMatrix::track ( const SizeStd &  _track_id)

Returns a track: its features indexed by time stamp.

◆ track() [2/2]

TrackConst wolf::TrackMatrix::track ( const SizeStd &  _track_id) const

Returns a track: its features indexed by time stamp.

◆ trackAsVector() [1/2]

vector< FeatureBasePtr > wolf::TrackMatrix::trackAsVector ( const SizeStd &  _track_id)

Returns the features of a track as a vector, ordered by time stamp.

◆ trackAsVector() [2/2]

vector< FeatureBaseConstPtr > wolf::TrackMatrix::trackAsVector ( const SizeStd &  _track_id) const

Returns the features of a track as a vector, ordered by time stamp.

◆ trackAtKeyframes() [1/2]

Track wolf::TrackMatrix::trackAtKeyframes ( const SizeStd &  _track_id)

Returns the features of a track whose captures belong to a keyframe (in the problem)

◆ trackAtKeyframes() [2/2]

TrackConst wolf::TrackMatrix::trackAtKeyframes ( const SizeStd &  _track_id) const

Returns the features of a track whose captures belong to a keyframe (in the problem)

◆ trackIds()

list< SizeStd > wolf::TrackMatrix::trackIds ( CaptureBaseConstPtr  _capture = nullptr) const

Returns the ids of the tracks of a capture snapshot (all tracks if nullptr)

◆ trackSize()

SizeStd wolf::TrackMatrix::trackSize ( const SizeStd &  _track_id) const

Returns the number of features of a track.


The documentation for this class was generated from the following files: